﻿using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;

namespace Letspirate.Utilities.ExtensionMethods
{
    public static class BitmapExtensionMethods
    {
        public static void AddOnTop(this Bitmap source, Image image)
        {
            using (var graphics = Graphics.FromImage(source))
            {
                graphics.DrawImage(image, Point.Empty);
                graphics.Save();
            }
        }

        public static Stream ToStream(this Bitmap source)
        {
            var stream = new MemoryStream();
            source.Save(stream, ImageFormat.Png);

            return stream;
        }
    }
}
